<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.5/themes/default/easyui.css"></link>
	<link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.5/themes/icon.css"></link>
	<link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.5/demo/demo.css"></link>
	<script language="JavaScript"  type="text/javascript" src="js/jquery-easyui-1.5/jquery.min.js"></script>
	<script language="JavaScript"  type="text/javascript" src="js/jquery-easyui-1.5/jquery.easyui.min.js"></script>
	<script type="text/javascript">
	
	$(document).ready(  
			  function(){
				  var url = "loadComboxData";
				  $.get(url, function(data){
					  /*var msg = $.parseJSON(data);
					  	
					  	 $('#cc').combobox("loadData", msg);*/
					  	 
					  	/*response.setContentType("application/json;charset=utf-8");后台需设置*/
					  	 
					  $('#cc').combobox("loadData", data);
					 
					});
				  
				  $('#login_name').textbox('textbox').focus(); 
				  
				  $('#login_name').textbox('textbox').keydown(function (e) {
				      if (e.keyCode == 13) {
				    	  $('#login_id').textbox('textbox').focus(); 

				      }
				  });
				  
				  $('#login_id').textbox('textbox').keydown(function (e) {
				      if (e.keyCode == 13) {
				    	  $('#login_pwd').textbox('textbox').focus(); 

				      }
				  });
				  
				
					   
	 });
	
	
	function submitForm(){
		$.post("add_user",
				$('#ff').serialize(),
				  function(data){
				    if(data=='success')
				    {
				    	alert(data);
				    	$('#ff').form('clear');
				    }else
				    {
				    	alert("新增用户失败");
				    }
				  },
				  "text");//这里返回的类型有：json,html,xml,text
	}
	function clearForm(){
		$('#ff').form('clear');
	}
	</script>
</head>
<body>
	<center>
       	 <form id="ff">
       	    <table>
       	    	<tr>
       	    		<td>姓名：</td>
       	    		<td><input class="easyui-textbox" name="login_name" id="login_name" style="width:120px"/></td>
       	    	</tr>
       	    	<tr>
       	    		<td>登陆名：</td>
       	    		<td><input class="easyui-textbox" name="login_id" id="login_id" style="width:120px"/></td>
       	    	</tr>
       	    	<tr>
       	    		<td>密码：</td>
       	    		<td><input type="password" class="easyui-textbox" name="login_pwd" id="login_pwd" style="width:120px"/></td>
       	    	</tr>
       	    	<tr>
       	    		<td>角色：</td>
       	    		<td>
       	    		<select id="cc" name="role_id" class="easyui-combobox" panelHeight="auto" style="width:120px;"  >
       	    		</select>
       	    		
       	    		</td>
       	    	</tr>
       	    </table>
        	<a href="#" class="easyui-linkbutton" onclick="submitForm()">新&nbsp;&nbsp;增</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" class="easyui-linkbutton" onclick="clearForm()">重&nbsp;&nbsp;置</a>
         </form>
         </center>
</body>
</html>